package kr.hkit.androidcomplete03.ch20;

import kr.hkit.androidcomplete03.R;
import kr.hkit.androidcomplete03.ch20.FragmentTest.CounterFragment;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;

public class FragmentArgument extends Activity {
	EditText et;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.fragmentargument);
		
		et =(EditText)findViewById(R.id.fragmentargument_startnum);
	}
	
	public void mOnClick(View v){
		if(v.getId() == R.id.fragmentargument_btn){
			CounterFragment cf = new CounterFragment();
			Bundle args = new Bundle();
			args.putInt("start", Integer.parseInt(et.getText().toString()));
			cf.setArguments(args);
			getFragmentManager().beginTransaction().add(R.id.fragmentargument_fram, cf, "counter").commit();
			
		}
	}
}
